package com.esirong.whatime.mvp;

import android.os.Bundle;

import com.esirong.whatime.ui.activity.BaseActivity;

/**
 * Created by my daling on 2015/7/10.
 */
public abstract class BaseView<P extends MvpPresenter> extends BaseActivity implements MvpView{

    protected P presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        presenter = createPresenter();
        presenter.attachView(this);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        presenter.detachView(true);
    }

    protected abstract P createPresenter();
}
